import { assertType, describe, expect, test } from 'vitest'

import { anvilMainnet } from '../../../test/src/anvil.js'
import { celo } from '../../chains/index.js'

import { createPublicClient } from '../../clients/createPublicClient.js'
import { http } from '../../clients/transports/http.js'
import type { Block } from '../../types/block.js'
import { getBlock } from './getBlock.js'

const client = anvilMainnet.getClient()

test('gets latest block', async () => {
  const block = await getBlock(client)
  assertType<Block>(block)
  expect(block).toBeDefined()
  expect(Object.keys(block!)).toMatchInlineSnapshot(`
    [
      "hash",
      "parentHash",
      "sha3Uncles",
      "miner",
      "stateRoot",
      "transactionsRoot",
      "receiptsRoot",
      "logsBloom",
      "difficulty",
      "number",
      "gasLimit",
      "gasUsed",
      "timestamp",
      "extraData",
      "mixHash",
      "nonce",
      "baseFeePerGas",
      "withdrawalsRoot",
      "blobGasUsed",
      "excessBlobGas",
      "parentBeaconBlockRoot",
      "size",
      "uncles",
      "transactions",
      "withdrawals",
      "totalDifficulty",
    ]
  `)
})

test('chain w/ custom block type', async () => {
  const client = createPublicClient({
    chain: celo,
    transport: http(),
  })
  const block = await getBlock(client, {
    blockNumber: 16645775n,
    includeTransactions: true,
  })

  const { extraData: _extraData, transactions, ...rest } = block
  expect(transactions[0]).toMatchInlineSnapshot(`
    {
      "blockHash": "0xac8c9bc3b84e103dc321bbe83b670e425ff68bfc9a333a4f1b1b204ad11c583d",
      "blockNumber": 16645775n,
      "chainId": 42220,
      "ethCompatible": false,
      "feeCurrency": undefined,
      "from": "0x045d685d23e8aa34dc408a66fb408f20dc84d785",
      "gas": 1527520n,
      "gasPrice": 562129081n,
      "gatewayFee": 0n,
      "gatewayFeeRecipient": undefined,
      "hash": "0x487efb864b308ee85afd7ed5954e968457cfe84e71726114b0a44f31fb876e85",
      "input": "0x389ec778",
      "nonce": 714820,
      "r": "0x1c0c8776e2e9d97b9a95435d2c2439d5f634e1afc35a5a0f0bd02093dd4724e0",
      "s": "0xde418ff749f2430a85e60a4b3f81af9f8e2117cffbe32c719b9b784c01be774",
      "to": "0xb86d682b1b6bf20d8d54f55c48f848b9487dec37",
      "transactionIndex": 0,
      "type": "legacy",
      "typeHex": "0x0",
      "v": 84476n,
      "value": 0n,
    }
  `)
  expect(rest).toMatchInlineSnapshot(`
    {
      "baseFeePerGas": 100000000n,
      "blobGasUsed": undefined,
      "difficulty": 0n,
      "excessBlobGas": undefined,
      "gasLimit": 20000000n,
      "gasUsed": 5045322n,
      "hash": "0xac8c9bc3b84e103dc321bbe83b670e425ff68bfc9a333a4f1b1b204ad11c583d",
      "logsBloom": "0x02004000004200000000000000800020000000000000400002040000002020000000802000000000000180000001000020800000000000000000000000000000000000000022000260000008000800000000000000000000000000000000000000000008000410002100000140000800000044c00200000000400010000800008800000080000000000010000040000000000000000000000000000000800020028000000100000000000000000000002002881000000000000800020000040020900402020000180000000000000040000800000011020090002000400000200010002000001000000000000080000000000000000000000000000004000000",
      "miner": "0xe267d978037b89db06c6a5fcf82fad8297e290ff",
      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "nonce": "0x0000000000000000",
      "number": 16645775n,
      "parentHash": "0xf6e57c99be5a81167bcb7bdf8d55572235384182c71635857ace2c04d25294ed",
      "receiptsRoot": "0xca8aabc507534e45c982aa43e38118fc6f9cf222800e3d703a6e299a2e661f2a",
      "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "size": 24429n,
      "stateRoot": "0x051c8e40ed3d8afabbad5321a4bb6b9d686a8a62d9b696b3e5a5c769c3623d48",
      "timestamp": 1670896907n,
      "totalDifficulty": 16645776n,
      "transactionsRoot": "0xb293e2c4ce20a9eac253241e750a5592c9d3c1b27bf090d0fc2fa4756a038866",
      "uncles": [],
    }
  `)
})

describe('args: blockNumber', () => {
  test('gets block by block number', async () => {
    const block = await getBlock(client, {
      blockNumber: anvilMainnet.forkBlockNumber - 1n,
    })
    expect(block).toMatchInlineSnapshot(`
      {
        "baseFeePerGas": 638630382n,
        "blobGasUsed": 786432n,
        "difficulty": 0n,
        "excessBlobGas": 1179648n,
        "extraData": "0x546974616e2028746974616e6275696c6465722e78797a29",
        "gasLimit": 36000000n,
        "gasUsed": 17334457n,
        "hash": "0x019d374731477005b8d3e3236aca44d11ef53fc9eb0ab0c9e11f942636b04b1b",
        "logsBloom": "0xcda3b1e63155a898a93999e387a05eb1b1cbfb76c4616163a28b881936d3c7d71849480530edf32ce4361bc50ea6cd053ef9b2a2beee76a443ddf666042e96d926f5854a32958b2eea5052dc0c704de92b8759b9117f7ea13c31da7ec8679653104a5780fb7e22f23d0c9d27ac26b8cca26e7dbe143c5670960450be989e97359822a41d0d4ad1dea8cb3beade73042aa90187e36506e40d27222dc641bf75bb9f69f46493b0a8a0585951e0d089c6f5169459df9faed8a96bf2cf3e46aa597d67509cbad50ecef967990fb24f3bf8f60effa67f776f0c9b64cc0b2aa1b26fe39717ac7fe7343432127d7614b5d23bd29572d1044b2f80c0ff2ec1dd20dbe49d",
        "miner": "0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97",
        "mixHash": "0xa1ff4358dc937c824424ce1271cd648e537acea45e05f2469dda6e1298cb20b9",
        "nonce": "0x0000000000000000",
        "number": 22263622n,
        "parentBeaconBlockRoot": "0xc469f9aab4da404f6a81a44e9b4396b0e612ddc9d997a9f7cef600e28277064a",
        "parentHash": "0xbdcf8d6c1b3f3da147a760db3a13747580369054ab84d65fef01da26b992a678",
        "receiptsRoot": "0xd63f3521779ec6e06e309d19cc99851bdaa0728c74e9d46e0f121c973e7a0c61",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": 168825n,
        "stateRoot": "0xc77f77fae13e4710d82decb78a620f46a4fb832d64f6c832fee3a46ce4713098",
        "timestamp": 1744590287n,
        "totalDifficulty": null,
        "transactions": [
          "0x546e80faa036cf6a1788b307a33b42a185f9eb07d99e0f5b87e7bc92c65ddf80",
          "0x8341f8eb62e67af4ecd11d3c84996580c9517ca3424a40588b63ecc5c1182f51",
          "0x4b3fd6dbad2653f5d0ec04206740dd9e79ebec67f8654a8d30b79cbb5933d954",
          "0xb0d42507edef5967699db35aa93893cbe019e7870166575d7d43b4b2473e3dee",
          "0xcb6ab0a6f5aaa71f982e99465974d5bbc09634e6fa327f5ea8dd7120827564b2",
          "0xb8c7d42351bdab386cca79c60ae3bae78f50e210eb4ae2f08312c17d8cc7a8a5",
          "0xd4fb7b6ea1e10196aaf765dfa43d2ab49c522928588464bcfe77eac0a96fb089",
          "0xb029e949184740b5e259c2119d60cf83f9d1b1aeb39ce0d185e305a7af38a5fd",
          "0x3f4137e51251f8a5131278c989dc5ddc3ab624fb956fada369f0683a4376b55f",
          "0xaf81658f68df87f003383d3c491e52b48e33223a752de80a90e14d9527708059",
          "0xcb3c413b69d871e0148c7ab4b3ecc57aef8b3173cdf2ed22e69be23027731635",
          "0x5741419de567601a843a39785ddf87c453e253eb783e4627140d360bde26c788",
          "0x8702d050e86c50d509248b4b18f29027ffc0fe72212145358aebca6bfe059838",
          "0x09b0881b595ddd2fc43748f713998ff250ec0ce148a594062eeb66baf62a96a1",
          "0xe252018784b6fcfff14dcb7377c8aae40d8e5bd9911901fa8f482149cb290dab",
          "0x54ca6cec7fa3f98586d5ecc926404f2a0a9e22baa0ec582ef66f34f99b521bd4",
          "0x7b8c6d9aa04417d01d92109365f0170b1145cd3e643ac6d125ec3da49ed7dee1",
          "0xbbde220c651767d678e0f7b0353df80f289e32d696941433d23577a4ae615d9b",
          "0x6790b6f8bfb6c3f1ab70322e5a94a1cda38c583aef42d8dde876165efbe8485b",
          "0x0c582236f8cfedff03e5b3f4385e019f2754c237220fc310c2a8f1010eac1d38",
          "0x4a269e8ea3dffbdef50065de830958e5df57111a165224b68be1c0bad3eb0e8d",
          "0x4ff6225d2949e1deb221d7dfc3323ac8e21728adc994ad5286899c450d42da22",
          "0xf02fbb10f98fbdb1eaa4b7089be8d649142bea1b25eb851d7321f4a8986f151e",
          "0x341fb7b08854ac19c287da4cb79ff5f0b6f3979a704cfe1352edf5d6b1e9b49c",
          "0xc794b0bb6cbc361239f9fd5d31b96dca4643fe5d95852b44696ca120790b2bea",
          "0x58f23ae82355fb5ca4a8f44df6871080f7f218ff5adae90f435647dd4c0d23e9",
          "0x7c376622c818a1faf99f9e49e1bd380a74a46ad020efab62363e312669ebb4d3",
          "0xb63f649db17103a2517422da318235141daf881c3916cfa355b6d2bd73cc15ab",
          "0x6e932759bc62cc7eeea905bf3fe9573a5f0c0beb2eb062407e2a39569934d8f7",
          "0x255888e2840e26d785b281849a219af69ae9ba5314dc3abf543a2bcf5ad5fadb",
          "0x741b2fa60dd7e29662a49ab86fa43613e5b3d72e38552e8f46cc62343c63873d",
          "0x17f2fd3f73cbad236f23a2bfbecf71323386a305c814895d1e73d1a7f3707f74",
          "0x879b9ece38cf9642847a5f922f37e59b61ab1e9f08794743ab75a1fd9f2df48c",
          "0x74ffd4c4b8d37e0dd21c7dd390769e2361934fd31aaa9747af75bb438b6afb33",
          "0xbd01d0fe02bcfb66ea284d76cd7aa2d2b1e9f84b8473134b2b8fdc0d652e7bb5",
          "0x0db54fd31b43465540590d25d20cd6c701ad8f3414e31edf8c7f8012deec6b54",
          "0xe30ac67f27092f2c69bd0dfd052225a582272fd7b84813d10fa5c11483d97bcb",
          "0xedb17452246b3ff506cd3eb31caf1499f6f5a7858f0cc888ecb0020287581eb0",
          "0xa87e4b55297e0e9081ddb95f56f1c90fee5dd5455768f78a5512e1a9d92360d1",
          "0x8beabbce5e83540646c57ada0d84dde1cca00406ea73c1e33580df2b4e70d72d",
          "0x240c2417a6bbbe9731d86d346f49a7ac9466b45345b7fca2c2bd77856a31e9d7",
          "0x7f7882a080aa0989757ac17ab13d9c666e4bacde0d8b8bfd7b68f9ea824032e1",
          "0x08a5c57f47b2c20752ec77af073f6c623f58e42a2e09f58d3077db198ae27d67",
          "0x29ac45605d8e1149443f9bf8cfcd55b11304a433ddd82a4251644000fbfa6bc7",
          "0x750840dc81202e4d9310d8bc5253be50d0590f63210c77406ebe223cc86a473d",
          "0x2d8f4120e2592c2295989d49cf986ec46c5e0b51707934c187b6035daacb1aca",
          "0x761b9cce53f6972992c649c442e8eadd1bea044e55ab0bf41782efdb0ab911f9",
          "0xb7923b6d938e9df6b0c1ca11a266977a51e119db24acea623d4ac88ce336e0ac",
          "0xd465782ba9646692471450dcdda41cb4a384e6f47bb7474a0dc7ca1cc8f096ff",
          "0x75a381218ecbe11d561ae090cbf5d5353fc12d8dc3df6c0bddc6c860ab57b0ba",
          "0x59f27c97514dbdcec7ea92767106b5219d80ce41f869cbb54ff697cc0d451407",
          "0x4a05ac4a79805c3994ba0818d8fd3f159bc8746337f1ccb520ae68866f5b7433",
          "0x00924cffd4cfb15c10dbb43032f5c395444cbf7ad88871c87a6c816aa1dc0533",
          "0x98cdee5d2f0eda3f06add00369d9ba9f0de9405b478727dcb54d54c2099a5b65",
          "0x71ee9f27bbd58f88aee19e377aa86e48367fdac251439863d4e5e13b61901ad8",
          "0x995e8b6d497c57f943438eaeb15eb6b79e3cb3879b437c6f2f58234b4c0dd33a",
          "0x9c900268be1f9005528b9232f3659f316d7c247306a566ca7cf66d00d380e2bb",
          "0xe70ae740fdb92effc90363c7c3590bf3843120e3a3da5dd60010cf4c19229409",
          "0xa85673d5bf45a853e1da2396a85785c8e11e72599cc6bb4aa30e97b87e85fb33",
          "0xd75042d86c589a69e099adb966c0452ce911a5e8a2cd9f117b3158837bea929d",
          "0xe5e53d5b25cb0fbda4ca5f9fead46194f6342499f39c2b93673bafa42a1103f8",
          "0x8340d15d81b110cbf2a6c71d9d37a2e970a468a702fd3db932f3dbd455f5436a",
          "0xd0f5a1a98f446ed5d555ae47c0c9ef549d313162525a3b9c1b47a06a005aab8a",
          "0x71dd057faf20462ec8b5d591bf69768d0122294dc2cce68a278d3c7957cbfd80",
          "0x4dd984dc5b6aad89aee89cc541e21b325da98f6979fafb4b8d813bdf1a9aa169",
          "0x650306c0fd46a6a3d3e9df691ef7073ca7df02cebff85c4c51a0a44e2f1fda5d",
          "0x28d521af15309b9c1fc88ad9ac18cdaa6455695519cd0c89433005736d51ef06",
          "0x8ef9fa2aa35788d65cbf5ecd470ab4f8f8cfd564bfcd46bb14079dd58716ab67",
          "0xd0b31acdf34845d3e5e93b5c3b5dfe6f9f755e0e8722d92c20b25e373273882a",
          "0xab25d15b351b1009222edbfaef649c7674625880404421912de10e48008f88c6",
          "0x5be7a952f893d12465463917bc0a77f3c2784844590248f6a66e45b177feee2d",
          "0x436d697a98721b6dc2a30d6bacf675f30fdced3056c6b560ec44cc81d0e136cd",
          "0xf5d0dc77bd91dd09ced0b3d0cb55e6446670fc003b1761f61e1eca6096ac2991",
          "0x13ba3ff884794b310297c02681fe4c3a6e9d9cffff6d396e0202b40f7ef707ab",
          "0xc5e669d2f9489366b709a910a9a80a0d00b12ee2af61843ae481b7a428f3bf88",
          "0xebc184987c09424cb8466b2773e26d960874943512f301e73a9b2aadb40fbff2",
          "0xe35de31dfb4defa82610410c9c5e0270b38814801e645df7b11d07b74bc0e972",
          "0xb5e61841e73d6c4c25329f23bbf351d41fddd08d4776e9c74a552573ea3bc433",
          "0x1a21b71fbe7fb8199fc0aa46414024d356b711095fb3c4ec11f0ae2bd2f39b3e",
          "0x6d1aa91fcd03650f5dceee5f6a355c99aae2c3d3587b275404a84350036d65dd",
          "0x42ee3da64818eed9032ea9078bd21bd12e3cbbf52c16487876a66e654edf91da",
          "0x6d0086e6b035d964d2ddb2e445ae9c0a80eede742480e0f30e001f34da8db10e",
          "0x1caad0b8db6f4a2b0dfe3a11787d5f81f6f1b51ca2148fcb68b86d1998875447",
          "0x286d1aaff388ffaab6e4635857a463758c3d3038e6582d4e04e970bb2c64f8ca",
          "0x25826e404f0279b2f6f37731715730ac5e2f8aedd449b0d43eef8d008940f9ee",
          "0x494506ab1f0fc788abca734983709938609182c209ffd727ce17b87876d1e7d5",
          "0xe11df62d1561ad27a8ad4ea1e4ad3a12c58d0fba1c242d11db389d20e006886a",
          "0x47d4371646468a61664becc83e8d999819ab8a932a589d43c18bd674d8f78d5e",
          "0x97e3573f34223e150fe3a77bf60b5f2ea4a39657a7c2820fd6ba3be476b60c5f",
          "0xc07ecb8c14682a562b72e4395a9b62e1fcc75de5baf1600d4088b2de92db1b74",
          "0x2ff6ae470daf98aa3c15a9c6664eace437e1bc4cf8901dcd9761fb2e984f69af",
          "0x6728c51d0bc52b00692f523708fef728dc77e012cea4f14e8db46d5546800fd5",
          "0x51ec03b64e3cb9e7657d4c8c4e227b77f28828db680301d14481df2e402140dc",
          "0x6adc5f97e47107b644906dc3b9f09390275fbfc572bb3c8b0c036e27dd0611b2",
          "0x6149df494e3e620d27391fa4e5ec1f2a3e93f1770ee0895ccdff52e9fbd66c4e",
          "0x8733068c5c273a6580ffffd1a191f4490fa3d6ca13c9c598ea320e42f665c521",
          "0x1be5347e654e505443f1b25a9a2584de4705afcdda2130d992de32448fd1b20a",
          "0xc7b368feab7f196b13bb9358d86abf03a4ff8181d14f9b90a5a0b644b58d08b2",
          "0xc824a730913cf2109b5bbf20921a04b6733de7e4282729254eff6c2daa4c3c68",
          "0xf853db31ae9d0e97df4ca88bf7708c7e4d709010bdf2caa9bc5b5b6f6b0a39a5",
          "0x5003599951319a1e619b925a5086790cd63f16310de50eb64443fb931b627bb1",
          "0x67ee8c2288efc23ba563163e048b3bff6dd41a66f5c43db8cf7b8714052969ac",
          "0x1cbb47291ba3c43f77b6a1675463aa62c52196c095260c6969cf11c9cd9a4047",
          "0xa655295abe9da2cb0a08c57e6077a9a6ba5b5c6ad1119f6b690cf3e361fe2d31",
          "0x8063bf85b6607e0dcd1dddd66f7cfb070716c93405730f4f02d3f9ae12afc9c7",
          "0x4a5899bdf715ec1e6dd3a4c1e38b23c66e53e6836bc43d840c0d5a5dc8b9636b",
          "0x822c08435f12ae69c61734553bfeeead63a5c91425d5a3cf80bf22a0b7df7368",
          "0x7bc12f018c61c3a80725e5cc8df440af4744e2ceb3edb8f27206a79b34d28afc",
          "0x2aa428f1fa7810e00c8103df3447e8ef956aa36fa7b674cbafa0640285a108d7",
          "0xa7445a339a44636a596ee4d32c2df88fe8edf6b66ab4afabf4025f5609f5bda9",
          "0x5796ae431964a79c71bdcf6373651d15765a6e54423a08bf9093f9aec1c3397f",
          "0x37b6f893db05827230ffed04486b045e23a5d5dc538814f02581de2ff8cb408f",
          "0x00c61933b49e88f9f65bf872ca00288090f6b59e188a41936e06dfdad06b535b",
          "0x3e1a8275b2a5f25d34abca806a0d45e54c07d7c25bda4ab0ab2f80d527a5ad17",
          "0xe06f93a82f1f6f32c20b87c1a9a9feff8f6b2bd7be3e0d6a080b904d104d7ff4",
          "0x8f5056c17c60b5380595764ce5f048fc2e684300009a776afe5d805d67d74d95",
          "0xd1e09ff5f08fa4cf016892d5aba4c0da0aaa5b467e35dcedc7cedfa21544785a",
          "0x5227ef193bbc2ea79b940a31e294e59bc858d58697c7ce1fff78fbcc7c4cf831",
          "0x64d5283ffbbd1ec5e4ec4a68dff62394b4e69aa2669e023fa00989de36fe7146",
          "0x1dd93692b8e3f4d75777aef5b9182324c5e8777c0103844d6c255ea38f8896b0",
          "0xed71c5d4c8bf1b283183b9e749c0cf479fc71778ddb588d2a20ed93f74dd06fe",
          "0x12d203344ba534560c8ffa267d3dc3750c89a2ad01901bb2748a6805e8e2aa6e",
          "0xe35eac556cdf3dbe419510bf05064b672dfba279a42f4725091b084d8eaabea3",
          "0x05711b6e41bd03ff2d7cfe750a5a37e480ea8538df71de05dacc36a992341e1b",
          "0xea70e6a658d121d98d212ec1da8a83522a3ced374510d0eed5d2f94760727b83",
          "0xde72559b8ebe894e62c57c13bb9327951717800642bcdab0afbe05066fde9553",
          "0x336810c2dca605c03bacbde44c46116123aeaa1ba636f06b8099c9280f7db533",
          "0x554746d2c90fe8e2af62555f6eedbb681f9c8de25d80036992f0a47732dcc31b",
          "0x4b5db690fee5f059c7d4703e663110fb0509a0a090268377612317b590830a6a",
          "0x6f41622860471acb9e10c82f777fe92fcc10e06e27483f251428a05b9d1fcdb8",
          "0x459ffb373ade7ba55a3dbeede9685f4a298f2b4b5ee30f381bf58f4e5779b9d8",
          "0x0497944f80a9fe66f0c002984ab56991b24d4caf26a6f35843ab1803c072c914",
          "0x8029f32dd6093413d0216ebdcd1cab10d30f2b623ec5dbb7bb0cd3f1d0891e51",
          "0x6cc9916d5a4df635b035b1408de0f93ac15b543fd3312a68342ffab1c96a9bf1",
          "0x2ed07b5eb60d7ac156b5f219cc5ce3b5957a509c63dc08cb0382adfc6e6b5951",
          "0x793e31b8db1635d61ea7297b5cd8e37359c7594ce462f814afe38f3d93a5b466",
          "0x25846e973d92c199707cbeaec89a4d04ee37b3e80aee684be24b12fae4ca37d4",
          "0xb0fcae7b2ffe52ea8989549d3579c9ca5e0356f9d3bfd7f4f59768841fdb42ad",
          "0xa917b53346a0666ca9af3fc9639e21d1721e7fefaba6a8143c41577064bf41cc",
          "0x3689af2620eac808ffa100a17bade21272a91e1b879c7d8b466a1dcca9d319c6",
          "0xbd2f53d1135ac15d1475126453adb10e97a90c5f9e1140d69bf4d9263a4fb0eb",
          "0x677537e14996062c20d7ac9f5a4a9b47f2d7697526299d2db7fa5634565f1f58",
          "0x83b698efdf16696b82d0562cc718593151b79fe0cde1dc35d4e1572952cd881d",
          "0x78bcca4f8affe3aec23c5145810fbed59183d2611cfed6bc3be0fea5cab91866",
          "0x1a41087ec689000d31bcd09069bf9460138e0fcad501dc2f4444cfcd61f5ee50",
          "0xd534e2a9430c774114047be12412f89bb7052ac825b59e2062be26a493702936",
          "0x5854dcf13f7977a2720df7956420ee26e723169fbc7bd63510dd8429ef52a683",
          "0x7b8e0e78dd110a0afa986776a5b7e9ea7a67c3c183ddff317b483a91e8ca5461",
          "0x50363e485fa5bc4f54152dfcf10418555240e39dad690a5dad34286299b7a533",
          "0x8989af5bad5bbcf639ffe2246268d40fb53274e427aa8ee333e86ec3074d3b02",
          "0x499b6407ed832a120a24ef05a3c4359324a72a100bfe21c04fc184c4b6a9369b",
          "0x83a6765a7e46f5a6f756068e5716eaee90b3f4473000ca7f405b6108e4d8d980",
          "0x13925cb1ea3804db1bded057b072342b695ffbb96a2cff8f917f3bf80dfcf05d",
          "0x4d56fd3a4e73c2e6ce6a56dcdbd9b039729c88dda946cd7ce065651abcb46fee",
          "0xb39144796d73fa7fd272067f7426ec8011879509e93246ac566a3d88356ce8ea",
          "0x7ee51f4db9b788250ff1fe3316d1626faf8e099922432402e15e423c897623ca",
          "0xe686b5a168a9ea0eac9fef29b9b63c125cad53d83885762b43d34f8b89af4f1f",
          "0xef4ac0e3fb50c429c691a6bba761bafff1df15a340196205c0535a0426dce891",
          "0x599205acb9fcb1f1da11de620427d7636f3f77994b868a28ed6ee0ebf5f8451d",
          "0x4a59a8f0ffdc571435493a721becc1708d20d7491dc623f3cca194e942c9da0a",
          "0xdb0dd8650fb9b32782015b002872e28b6075b04aac315451991e6a75e37d2663",
          "0xfb8f238e1af47bb8e3c98d2e6c08bca9d9ac9c2bf6b3b71fcff6c173000375cd",
          "0x7b37ac0fde15edecfa360f873fdf96bca246b0146d25c12fe2486bf1ae26477e",
          "0x33a454fa1b98c4b669d8169c9500095dcc875cfe9329d574638876d6300f29dc",
          "0xba339c3f82c5b5d034f179f32d96877788350f1d9b28d9f1a4be3bc497f2906e",
        ],
        "transactionsRoot": "0x822e2c38c94cd55d63810c0aed4d927eb3a3544adde08b106db721a1b62296e7",
        "uncles": [],
        "withdrawals": [
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1277696",
            "index": "0x4fc874b",
            "validatorIndex": "0xbee3f",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127aaef",
            "index": "0x4fc874c",
            "validatorIndex": "0xbee40",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127643e",
            "index": "0x4fc874d",
            "validatorIndex": "0xbee41",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1277957",
            "index": "0x4fc874e",
            "validatorIndex": "0xbee42",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127bea3",
            "index": "0x4fc874f",
            "validatorIndex": "0xbee43",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1277316",
            "index": "0x4fc8750",
            "validatorIndex": "0xbee44",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127543f",
            "index": "0x4fc8751",
            "validatorIndex": "0xbee45",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x3e86fe4",
            "index": "0x4fc8752",
            "validatorIndex": "0xbee46",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x121541f",
            "index": "0x4fc8753",
            "validatorIndex": "0xbee47",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x121a46b",
            "index": "0x4fc8754",
            "validatorIndex": "0xbee48",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1220af6",
            "index": "0x4fc8755",
            "validatorIndex": "0xbee49",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127a318",
            "index": "0x4fc8756",
            "validatorIndex": "0xbee4a",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1276f13",
            "index": "0x4fc8757",
            "validatorIndex": "0xbee4b",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1278821",
            "index": "0x4fc8758",
            "validatorIndex": "0xbee4c",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x126a720",
            "index": "0x4fc8759",
            "validatorIndex": "0xbee4d",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x12419ab",
            "index": "0x4fc875a",
            "validatorIndex": "0xbee4e",
          },
        ],
        "withdrawalsRoot": "0x3eec61c2568c5ac2103a25d8256ada0babe8b9c3848410b1f73765c98143a234",
      }
    `)
  })
})

describe('args: blockTag', () => {
  test('gets block by block time (latest)', async () => {
    const block = await getBlock(client, {
      blockTag: 'latest',
    })
    expect(block).toBeDefined()
    expect(Object.keys(block!)).toMatchInlineSnapshot(`
      [
        "hash",
        "parentHash",
        "sha3Uncles",
        "miner",
        "stateRoot",
        "transactionsRoot",
        "receiptsRoot",
        "logsBloom",
        "difficulty",
        "number",
        "gasLimit",
        "gasUsed",
        "timestamp",
        "extraData",
        "mixHash",
        "nonce",
        "baseFeePerGas",
        "withdrawalsRoot",
        "blobGasUsed",
        "excessBlobGas",
        "parentBeaconBlockRoot",
        "size",
        "uncles",
        "transactions",
        "withdrawals",
        "totalDifficulty",
      ]
    `)
  })

  test('gets block by block time (pending)', async () => {
    const block = await getBlock(client, {
      blockTag: 'pending',
    })
    expect(block).toBeDefined()
    expect(Object.keys(block!)).toMatchInlineSnapshot(`
      [
        "hash",
        "parentHash",
        "sha3Uncles",
        "miner",
        "stateRoot",
        "transactionsRoot",
        "receiptsRoot",
        "logsBloom",
        "difficulty",
        "number",
        "gasLimit",
        "gasUsed",
        "timestamp",
        "extraData",
        "mixHash",
        "nonce",
        "baseFeePerGas",
        "withdrawalsRoot",
        "blobGasUsed",
        "excessBlobGas",
        "parentBeaconBlockRoot",
        "requestsHash",
        "totalDifficulty",
        "size",
        "uncles",
        "transactions",
        "withdrawals",
      ]
    `)
  })

  test('gets block by block time (earliest)', async () => {
    const block = await getBlock(client, {
      blockTag: 'earliest',
    })
    expect(block).toBeDefined()
    expect(Object.keys(block!)).toMatchInlineSnapshot(`
      [
        "hash",
        "parentHash",
        "sha3Uncles",
        "miner",
        "stateRoot",
        "transactionsRoot",
        "receiptsRoot",
        "logsBloom",
        "difficulty",
        "number",
        "gasLimit",
        "gasUsed",
        "timestamp",
        "extraData",
        "mixHash",
        "nonce",
        "size",
        "uncles",
        "transactions",
        "baseFeePerGas",
        "blobGasUsed",
        "excessBlobGas",
        "totalDifficulty",
      ]
    `)
  })
})

describe('args: hash', () => {
  test('gets block by block hash', async () => {
    const initialBlock = await getBlock(client, {
      blockNumber: anvilMainnet.forkBlockNumber,
    })
    const block = await getBlock(client, {
      blockHash: initialBlock!.hash!,
    })
    expect(block).toMatchInlineSnapshot(`
      {
        "baseFeePerGas": 635678744n,
        "blobGasUsed": 786432n,
        "difficulty": 0n,
        "excessBlobGas": 1572864n,
        "extraData": "0x6265617665726275696c642e6f7267",
        "gasLimit": 35964845n,
        "gasUsed": 14170967n,
        "hash": "0xd028bdc00aff985bdf872d6b961110d41a6fe4df5e93aeb6dffe2f38ae0a4f7d",
        "logsBloom": "0xa336825265c0691c36791a28c7814901910c6b230e016020408d80135c1980b01016af2c481b78027612ff562ed6c7821228e23a0ccfea2b689d740905656000544085800d0928884ad6e10a344820e9f508517102f601cc0c081464d844b6993b4dd2a082e3462944ca5a4ab4227e8ce368046230b8974506a20496000f111406a9b5004e25a580a0e9204843b3100e18454253b384b508362280d101b634a12f62148431086a90625f16a482818f0841bac44db90101000f39c532160c7460d012000688201ea0013a33920e7b384728250356c52700955c3e2bc20891e2c62572a843e142470000051461200009428f79b8428b08a4c04b899412204954a5",
        "miner": "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5",
        "mixHash": "0x33fd71ca8e38da7aa264c9b9252b7d2864484826eeeae67c2aaf3ab0a756f133",
        "nonce": "0x0000000000000000",
        "number": 22263623n,
        "parentBeaconBlockRoot": "0xa7b4e889e408381f1860000a708b6e5fd42ccd9de7fb1cb442a8e91ecb9e6f6c",
        "parentHash": "0x019d374731477005b8d3e3236aca44d11ef53fc9eb0ab0c9e11f942636b04b1b",
        "receiptsRoot": "0x230fa17d30bd0ca83606cd4704400735bf05cd09110bc96eeee7dbfbc0f870c9",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": 88414n,
        "stateRoot": "0xadea44d9167ee7c415601810dbb3f090de70edfdea34632b7e077cefad038af3",
        "timestamp": 1744590299n,
        "totalDifficulty": null,
        "transactions": [
          "0xa830b5e09e6d2709eaddc555c12fe5177aa22a0862869aefab392d64bcb67926",
          "0xec8dae0c3c87e84115d6d80a13f18fa09149b26b6185dec8b1feb9277f57de16",
          "0x6bdee6726ede49f0caedbb039559a3ecbeb30beccdbad0d0ad34b7878fd76756",
          "0xec27e6ef7e8e0c5e495d978e2409f18d09efbac99f6a1d9766e8951eb20c1bb6",
          "0x388f16334f1217cf27bbefcc8798834af13166cd7857b5c56892b1ebeef6c708",
          "0x10f56c635bde3733b330e41fe1dedd83c303dbef4b713a87ad1fb0feda79a5e1",
          "0x0b20063113f3377255f2d1fe4e3277feadaa98d122ebdfa4f08b2e58113c3bf2",
          "0xa418d5bd350d6a7947d5801cfcda9aa9068cf43611cc5ec26a3e0996b3e6b1e0",
          "0xcdb2fcead0254ce044d050761b3308f9fafb1bc419a8ca9a6dc4b3e62c437169",
          "0x1b1e60b3aa4031704fae193d7f97a5484a1673f5ba2da0ee31e3b0858d839684",
          "0x59917ed06b3fa39d2d311086d6032e2abe1341a31db2422e9467afad00fabfe4",
          "0x185f39d2b7b2cbe0c0950ddc45df5948e167bbbceab235ae2b18193ccdbf3cf7",
          "0x9aa22d79c11e83cecc8043528527d9c88a62d6103ca8f250aa8cb86eca02eb11",
          "0xf914ecdf0c1922a1bd4effe4d2f15adaebea229b7b52ad610984a979ea09e565",
          "0x27feb453dd1e91b41d5860c32ac34470d101f6e5da57c57c4e0c074c5d00cd5d",
          "0x069bf514fa826397e81c88d4587530538e10baeb5e0388048030287d85b2b5f9",
          "0x6c89d2775e9919fe8afde564755021b2291a797490e7d64a42231cd0e9ebec85",
          "0x01975a1e08fac4209e625990cd4a0fbf2fa05e3c08d9e98898a5f50207f36c04",
          "0x5eb6d26ad0d67a9af50cccb5e4d2e7c11e8d9e86fe51c61483cb62b84dd8e2bb",
          "0xb600b487433b17d85b33ae7567e4558698afd3f72a8fa968985ac847055e09bc",
          "0x002dd9d9fc69777dfac9ae0cae8d9b47ece05930f3dc971c23a3e7674629ce72",
          "0x384b2c0059e7ecae49b44dfa6f5ed44fd9fac1dc0fab8c01d341cc886bd45789",
          "0x403412968589902149efd2df44385afa00c4299c52aa83d64008bbee0c953d47",
          "0xb6ef0c02e08374d3cea3eda42b8e08ed218033a70406712c9db64620ebe6ff62",
          "0xca031374a4aa643a169e7edbfa8505b310b52f1559c49f7bb1acbcbd9281f8fe",
          "0xeac0cf72d02033c8d24dd22ca23882773402f8791f57d9e3f161b1086cea39bf",
          "0x7ac526702bccafe985f08a35ab96250066f230bfa4c589696d52f388dc28cd9b",
          "0x7663feb1a75df42652c26c6c114d711956b03de8aada2493e8e858bc19163f18",
          "0x7dd2137fdb2f69d3714bbd8cdc1be5ad0a4503ddfe19ffb8e752ee3537a6baab",
          "0x88608458416217eb145836116357017d8ee7f0bff8f18e2a708b578645b115f7",
          "0x03037c03f30232ed8b486ee3e43212f40d7e48317c733fad92034850420a29c6",
          "0x96c58606a41010569c74160b3ff879948d4e254f305df63491dfb77637bb6fcb",
          "0xc6391d3137b9937cc53e7044c7fde0e9e3d37ff3e2ce3e2c2daa40a1e855e8d6",
          "0x126acf8dea4af4f8477d83fd40096277b8f46be7ce6f48c3f5ce12c73dbea9e2",
          "0x5a3bb37a3859bfc316580c2c3016e0a602cc578e518fff5a1ca560cc3d457ff5",
          "0x30c1bdd22384b8a1187dc5c30fe0aed454e1bbe724fad44e619fcf26287455a5",
          "0xd664ff7bd195031873ab12bfddc3399bcab5a5e5e6b66e0ec9e7aca5eea533b9",
          "0x52353a3786a5bc637d2a767d440a13ac426ae372301882a69cf99be5c08b9b34",
          "0x8640c1cb3208b965e5405b952d4400f76ba5942640b6ff75559411d567c6624b",
          "0xfc401c21638aeb2b853bb0e29bae2468fe6d757e76f455a0e00061301d243692",
          "0xced23b981bc2fd12d5b45b8ae3f5b0effbb21cadc2d6431f677621ec8023ffc2",
          "0x2b63a9e4d7d27a19ad8c84e2035b0bc5e1e2f61ceb53ad9fa7569f639bff78ec",
          "0x9991c76fa2ba076162f0b8d21b9b2a6b2b9fe9dd5403dd6a4a05a72c85569a03",
          "0x9a3a09b54dcae0cfe70d12a5d675f7e400d3f6d5c3b43ec018c7c1f587584ff4",
          "0x848d7a6be7e269ee54437dc0272501e3aba635ad277903abafd75a21652ebde3",
          "0xf4afe5774ac8d7196ad36103769ef606faa8a1c70284b609d5993db3c99773ee",
          "0xdb2cc3a2dd936e22f3cccdacd3a95d6541070e2a0a9440b68d5b17036c791e25",
          "0xdfc82c9edf56322fc2b2b42c49b4053fada87559d4269dc7f62df2043dff0391",
          "0x6d4131a2c049efb6cbe31fcdc03aba6952875efbc8df336b915aea67a6d17cfa",
          "0xc469810e7856cf8d1f748f2e5f8f80084253272019056b69474d0f10ff181ece",
          "0x313e76bb4c1d58dd51df593e00369185d3612a660f67d5a3751bc341585b1eb4",
          "0x6baf070c42ec0033ff0b0dec233c4ce7ab4f8b94369f67d02a6eb1a48ca6dff9",
          "0x7544a200cb8855073410e2ef14666a2846f9e3c962fd68ab060bc63b2bf376f8",
          "0xb6ca49f11c2be3541178e6896b98bf47b7c392e20c8c4c9e8dfc439ba7d34d37",
          "0x5252bea73f0cb25d0096362e39faf73dd86eb1d1de8449bacf4aa7da96eaec4e",
          "0x666875fa51d4cabf200b63db9b7c3110c593c60658f9ee174181ed7790a6f6de",
          "0x68dd0295bf7d2f0d636ebc5d551db39132b3c8dc2374c1382a3a91d753cc93f7",
          "0x4dbf6d86b0c8f87589b44fa8b8986684febb58815be0fb51bb5ab4904c3dd816",
          "0xf5dac89d6f756e8e0728993f91420f883658306974b85df38d86dab3b1b66522",
          "0x1929a2dd505f80e1d883eeaaccd09c3392e5d9ff0d42ebdf869bb413e72ae406",
          "0x43c076bffb1b83e9208776bdc63b8e52ca2957c0f53966f0d388d97fe90ab84f",
          "0x67abe41b249287654a1e34d15f386a11fb384dcb406ad179b7b6b6e2c66fbc58",
          "0x8a8a45cea8595016bcad108c281ee8612cb0f6d4397d368315488feaa5f798d3",
          "0x11592924727a9175d05e57635dc4b7eef9bebf67da90d590adeb3f2f27d3f4f4",
          "0x8d816313b6dd7524ec3a22f82edee1aeb147a8468824c29bf48b53d2dc78a160",
          "0x180de77173fd1e0a108a191f79edd955e35728d4dc17f00f3eb4f2a5aeb40d53",
          "0x118f5228f1faf3c2301201d0451e578bae7bd7fae9c2aa860a85877fc94065d6",
          "0xd23194a13c3302913bc044b8912f6361dfa997e667a8e00913e1349df04586a4",
          "0x16395ca6eb8963ee04e3181c7233fa417678bc9446bd2602bf5f9b8eeb5b17c4",
          "0x9d50f7dd271dff2451b4021ff75d0e581eae95d67260bc2ddf0c3e06d08b58f6",
          "0xe342270887c85b5a5be6068ca116ebdf4a53ee29f5cbd0b1b6dd9b66f99699ec",
          "0x74960a4a67cbf20e4e660747e16d9c82eff0b614baf34fc98dd125323555e319",
          "0x0ba0a9eb5c3ba2700d70d1cb00dd1ba892205f47883690f5343f0d6e8a012110",
          "0xbdc97aa06937fbb6227deaaf4242c4c136b03f7bf1c466b672c96b1e1994203b",
          "0xccef5dd7738d65689ccfab4ce87431132dcff26c30f1337017c6f2cd2573f121",
          "0xd4b7fa9c33c877ad0e0ca65caf27998e7d32bc3ef9cd351c2c318b294468c8ab",
          "0x676858b075e31a88caf5d84bfb5e8bc8f1fda60c8b47ad6d1510e16025dab1b5",
          "0x467afd1e746c073475d396198420fb504c330bc9759a9d49fb375c3831ccd863",
          "0xc41560172f2c1e5880de04c06bc28872cf1aaf2bf5e86a42979b4ecfcd44d311",
          "0xfc505c0a8009f008433aaf366e7a8a585f66336e77ab3066630552bb8c67a800",
          "0x7454273c2845eea8611fecce8016bcbf7571959a1600c7ac97387ed3510e3582",
          "0xdc856c8d91705f4b3d03964c8ad4befc3799a8849f2d527709432db45d3a388c",
          "0x17d71b1691589e9597fc6d29d571be8d674f86538355806e697af188cb18eea9",
          "0x5f0faee4777596897c3f8b7206ae31fe7ed5d3eb4718cdba07e1e743cda7cc1a",
          "0x7c68af4b9e5c22ce5bcf74929a19180ad06125a80e9118128b653d0056260c58",
          "0xe222040952e6f7fd617290b7b8904b00f81ef49e4fb37be040db1f66f1f4ddc8",
          "0x1ad0b706c9a1d376cde377fb73395ecd5e0e55f428ad3299317806daef8de882",
          "0x4f24aff0b5d7269902fef75cb69ba67aefd39f114f91b0d7a519e86e10d9c8b7",
          "0x32e23029b54b3ffbc78c4e9f115a4cbefe65faf67ec295e2ad9a0603ed44d4de",
          "0xfc424bbd777126fb913242238dafbacdd75344b6fd0f6d524d64f85b7420627d",
          "0x2742143d7f34fa33714619ccf9c1f01f4f32a47ccbf69b6ecff00d398c483cf7",
          "0x81d16e35c2f2372d18b2898778cd9f81eaa0a553b06bcc2620d69d2df39431ac",
          "0x5ff48d7e61c45a9be174bf915f864318123dd16458550322b2fca85490a4c0f6",
          "0xdfedd288385085f2f33a4235d9e65dffca463c555f3ef351f7ac6992360e6980",
          "0xf8e19739eb8068854f9e6a2274a826228896d0e8c56b33ace69199a92385c6e4",
          "0x72c03ec1db7496a464214c3c17c2303d55882ff873ddd42cd9aadd11d6cd4674",
          "0xcd66de6e1ba35f34e0c1ae90d470abba0b39cb798909db5350aaa0414121cfa6",
          "0x647544c734fff0189ab55e86e2a38c78d4764aea12ed0cd16c3dbee9aca5a4c9",
          "0x2fd9010ba8d614a8492c02914bc5aa9504e588ce2b98b7c097eb78c02318f734",
          "0xf9e4ae3673db5a8961fdbd3253643b2f09a475b76a2d3639671bb5b8d8df8599",
          "0x269240fcb4257e6e0b2d970d8a08b06fd56226b0afbc3c41ae952cebd1d1e84d",
          "0x2f9db6986f9d46736e6532030627e0be514e6e7c8d844e316ec589d3e0dbb573",
          "0xeb32497fce6f101f55959ea2ac0b090a0b26032865c74e279754ba13384f2245",
          "0x4257448420523d4320b38aee51ef17e72ad59b316c390267f524dcb51fa1f3e2",
          "0x511ba0618f654bce433edc15ead66c282b9628049398b117c8dea68b5956484c",
          "0xa5ab42e4353a63a1dbbb5fcd9827b0b5784468b4c71074ad5124eb84ea87b687",
          "0x018b3ecb07b3487253f4c6f26c4a66518e5b4127433da45e10f88a458da19932",
          "0x8d9c8a91a8ffb007f20622068d27b3d21e641cf4495bd7791f76eff22bbe3b5a",
          "0xc65564c139b75062f4989cb2eed6c436e6036f281c8c5dfd811911b7575b03bb",
          "0x1fa029e5ff784a280d1d3aa8a0738942ecea6f271d0b3cb852edd2233fbf807b",
          "0x893eb054cc26a7f84904a4c038f8b5ab62b6fd97201526308699c6f750879cb8",
          "0x52150a57b9f7e1b4cd27294a81a27966421a791b11238075818d70683fd716d1",
          "0xb56f65e5aa53351984d177cb0e9099f386c10ad0989255b0dc2818982c08794e",
          "0x2a2b18674d4e5955ead4f4c3ee115e26ccd4f5d16112fc8438ab4424f18ec9bc",
          "0xb30bd6264b27feec0fb74dbf5c0dfbf0c2f6c4e7a69c0c265f3fad84f94f622d",
          "0x30f32b6cefaba17d25b5a8c58cd42c60e19a7f0dd1f16251bfcede5bda55b7bc",
          "0x48c3c9f6a2344284079d4ee6ffc186c5eb36a5a5a88c3c2e256690d6e5a9dc15",
          "0x6a29c02a54d80de73c015bb4f769ec74fdb61e784b0ca07ecb5c88adc0554e4b",
        ],
        "transactionsRoot": "0x5c41008fd93b95aff0a1a453b657539b7e43d67d20c196c87fe59f5f2f1dd214",
        "uncles": [],
        "withdrawals": [
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x12380f1",
            "index": "0x4fc875b",
            "validatorIndex": "0xbee4f",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x3f62a7a",
            "index": "0x4fc875c",
            "validatorIndex": "0xbee50",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1256773",
            "index": "0x4fc875d",
            "validatorIndex": "0xbee56",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x125b69c",
            "index": "0x4fc875e",
            "validatorIndex": "0xbee57",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x3e33e35",
            "index": "0x4fc875f",
            "validatorIndex": "0xbee58",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1266095",
            "index": "0x4fc8760",
            "validatorIndex": "0xbee59",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1278100",
            "index": "0x4fc8761",
            "validatorIndex": "0xbee5a",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127ad22",
            "index": "0x4fc8762",
            "validatorIndex": "0xbee5b",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127d890",
            "index": "0x4fc8763",
            "validatorIndex": "0xbee5c",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x12612df",
            "index": "0x4fc8764",
            "validatorIndex": "0xbee5d",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x3e39635",
            "index": "0x4fc8765",
            "validatorIndex": "0xbee5e",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x126c872",
            "index": "0x4fc8766",
            "validatorIndex": "0xbee5f",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1268edf",
            "index": "0x4fc8767",
            "validatorIndex": "0xbee60",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1267257",
            "index": "0x4fc8768",
            "validatorIndex": "0xbee61",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x1269208",
            "index": "0x4fc8769",
            "validatorIndex": "0xbee62",
          },
          {
            "address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
            "amount": "0x127534c",
            "index": "0x4fc876a",
            "validatorIndex": "0xbee63",
          },
        ],
        "withdrawalsRoot": "0x96c5c22e9b58cb7141b2aecf4250fc84b0486a00a78353cdcfc9d42c214b2127",
      }
    `)
  })

  test('args: includeTransactions', async () => {
    const block = await getBlock(client, {
      blockNumber: anvilMainnet.forkBlockNumber,
      includeTransactions: true,
    })
    expect(typeof block.transactions[0] === 'object').toBe(true)
  })
})

test('non-existent block: throws if block number does not exist', async () => {
  await expect(
    getBlock(client, {
      blockNumber: 69420694206942n,
    }),
  ).rejects.toMatchInlineSnapshot(`
    [BlockNotFoundError: Block at number "69420694206942" could not be found.

    Version: viem@x.y.z]
  `)
})

test('non-existent block: throws if block hash does not exist', async () => {
  await expect(
    getBlock(client, {
      blockHash:
        '0xd4a8cf1bf4d05f44480ae4a513d09cddb273880ed249168bf2c523ee9e5c7722',
    }),
  ).rejects.toMatchInlineSnapshot(`
    [BlockNotFoundError: Block at hash "0xd4a8cf1bf4d05f44480ae4a513d09cddb273880ed249168bf2c523ee9e5c7722" could not be found.

    Version: viem@x.y.z]
  `)
})
